#include "types.h"
#include "stat.h"
#include "user.h"

int
main(int argc, char *argv[])
{
	int pid1;
	int pid2;
	pid1 = fork();
	int i;
	if(pid1 == 0){ //son1
		for(i = 0; i < 100; i++){
			printf(1, "first_son is %d pid is %d\n", i, getpid());
			malloc(300);
		}
		pid2 = fork();
		if(pid2 == 0){ //son2
			for(i = 0; i < 100; i++){
				printf(1, "second_son is %d pid is %d\n", i, getpid());
				malloc(300);
			}
		}
		else{//father2
			wait();
		}
	}
	else{ //1father
		for(i = 0; i < 100; i++){
			printf(1, "index_father is %d pid is %d\n", i, getpid());
			malloc(300);
		}
		wait();
	}
	exit();
}
